<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;

use Illuminate\Database\Eloquent\Model;

class HospitalUserBreak extends Model
{
	use HasDateTimeFormatter;
    protected $table = 'eb_hospital_user_break';
    public static function booted()
    {
        parent::booted();
        static::creating(function ($model){
            if(empty($model->opinion)){
                $model->opinion = '';
            }
        });
        static::updating(function ($model){
            if(empty($model->opinion)){
                $model->opinion = '';
            }
        });
    }
    public static $statusTxt = [
        0=>'待审核',
        1=>'通过',
        2=>'拒绝'
    ];
    public function family(){
        return $this->hasOne(Family::class,'id','family_id');
    }
    public function hospital(){
        return $this->hasOne(Hospital::class);
    }
    public function user(){
        return $this->hasOne(User::class,'id','user_id');
    }
}
